import 'package:flutter_common_fragement/generated/json/base/json_convert_content.dart';
import 'package:flutter_common_fragement/pages/common/model/user_info_entity.dart';

UserInfoEntity $UserInfoEntityFromJson(Map<String, dynamic> json) {
  final UserInfoEntity userInfoEntity = UserInfoEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    userInfoEntity.id = id;
  }
  final String? isCertified = jsonConvert.convert<String>(json['isCertified']);
  if (isCertified != null) {
    userInfoEntity.isCertified = isCertified;
  }
  final String? isSign = jsonConvert.convert<String>(json['isSign']);
  if (isSign != null) {
    userInfoEntity.isSign = isSign;
  }
  final String? nickname = jsonConvert.convert<String>(json['nickname']);
  if (nickname != null) {
    userInfoEntity.nickname = nickname;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    userInfoEntity.name = name;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    userInfoEntity.avatar = avatar;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    userInfoEntity.mobile = mobile;
  }
  final int? point = jsonConvert.convert<int>(json['point']);
  if (point != null) {
    userInfoEntity.point = point;
  }
  return userInfoEntity;
}

Map<String, dynamic> $UserInfoEntityToJson(UserInfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['isCertified'] = entity.isCertified;
  data['isSign'] = entity.isSign;
  data['nickname'] = entity.nickname;
  data['name'] = entity.name;
  data['avatar'] = entity.avatar;
  data['mobile'] = entity.mobile;
  data['point'] = entity.point;
  return data;
}

extension UserInfoEntityExtension on UserInfoEntity {
  UserInfoEntity copyWith({
    int? id,
    String? isCertified,
    String? isSign,
    String? nickname,
    String? name,
    String? avatar,
    String? mobile,
    int? point,
  }) {
    return UserInfoEntity()
      ..id = id ?? this.id
      ..isCertified = isCertified ?? this.isCertified
      ..isSign = isSign ?? this.isSign
      ..nickname = nickname ?? this.nickname
      ..name = name ?? this.name
      ..avatar = avatar ?? this.avatar
      ..mobile = mobile ?? this.mobile
      ..point = point ?? this.point;
  }
}
